package com.xz;

import com.sun.deploy.security.ruleset.RuleSetParser;

import java.math.BigDecimal;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author：xz
 * @Date：2023/6/19
 */
public class A {
    public static void main(String[] args) {
//        test2();
//        test3();
        String A = "1.DOC";
        List<String> collect = Arrays.stream(A.split("\\.")).collect(Collectors.toList());
        System.out.println(collect);
    }

    private static void test1() {
        String a = "你好;不好；";
        List<String> condition = Arrays.stream(a.split("；")).collect(Collectors.toList());
        System.out.println(condition);
    }

    private static void test2() {
        BigDecimal percent = BigDecimal.valueOf(0.24);
        BigDecimal percent3 = BigDecimal.valueOf(0.00);
        NumberFormat nt = NumberFormat.getPercentInstance();//获取格式化对象
        nt.setMinimumFractionDigits(0);//设置百分数精确度2即保留两位小数
        System.out.println("百分数1：" + nt.format(percent));//最后格式化并输出
        System.out.println("百分数3：" + nt.format(percent3));
        String format = nt.format(percent);
    }

    private static void test3() {
        List<Long> list1 = new ArrayList<>();
        list1.add(1L);
        list1.add(2L);
        list1.add(3L);
        list1.add(5L);
        list1.add(8L);
        List<Long> list2 = new ArrayList<>();
        list2.add(1L);
        list2.add(2L);
        System.out.println("list1:" + list1 + "list2:" + list2);
        for (Long a : list2) {
            if (!list1.contains(a)){
                list1.remove(a);
            }
        }
        System.out.println("list1:" + list1 + "list2:" + list2);
    }
}
